using System;
using System.Collections;

namespace Microsoft.Samples.Windows.Forms.Navigation
{
	/// <summary>
	/// The view state for a navigation context is a property bag that can hold arbitrary
	/// data. A page can record data in this property bag that can be used to reconstruct
	/// the appearance of the page at the time the page was viewed in this context.
	/// </summary>
	/// <example>
	/// Suppose an application displays the same page at many points in the navigation
	/// history. This page contains a list box on it. For efficiency, the application creates
	/// only a single instance of this page, and shows it multiple times. The application would
	/// like to have the scroll position of this list box stored with the navigation context,
	/// so that this scroll position can be accurately restored if the user backs up to this page.
	/// </example>
	public class ViewState
	{
		private Hashtable state = new Hashtable();

		public object ReadProperty(string propertyName)
		{
			return state[propertyName];
		}

		public void WriteProperty(string propertyName, object propertyValue)
		{
			state[propertyName] = propertyValue;
		}
	}
}
